import type { RouteMeta, RouteRecordRaw } from 'vue-router'

export function buildMeta(data: RouteMeta = {}): RouteMeta {
  return {
    ...data,
    module: 'SETTINGS',
  }
}
export default {
  path: '/settings',
  meta: buildMeta(),
  component: () => import('@/components/layout/DefaultLayout.vue'),
  children: [
    {
      path: '',
      meta: buildMeta({ title: '系统设置' }),
      children: [
        {
          path: 'system-config',
          name: 'SettingsSystemConfig',
          component: () => import('@/views/settings/system-config'),
          meta: buildMeta({ title: '系统设置' }),
        },
      ],
    },
    {
      path: 'admin',
      meta: buildMeta({ title: '管理员管理' }),
      children: [
        {
          path: '',
          name: 'SettingsAdminList',
          component: () => import('@/views/settings/admin/list'),
          meta: buildMeta({ title: '管理员列表' }),
        },
        {
          path: 'login-record',
          name: 'SettingsAdminLoginRecord',
          component: () => import('@/views/settings/admin/record'),
          meta: buildMeta({ title: '登录记录' }),
        },
        {
          path: 'admin-logs',
          name: 'SettingsAdminLogs',
          component: () => import('@/views/settings/admin/logs'),
          meta: buildMeta({ title: '管理员日志' }),
        },
      ],
    },
  ],
} satisfies RouteRecordRaw
